<template>
  <div>
    <!-- 磁致伸缩 -->
    <!-- 样本基本参数卡片视图区域 -->
    <categoryFilter ref="categoryFilter" :importDataType="'磁致伸缩样品基本参数'" @getInquiryResult="getTableInquiryResult" @resetQuery="resetQuery"></categoryFilter>
    <el-card class="box-card">
      <el-row :gutter="20" style="margin-right: 5px">  
        <!-- 高级查询 -->
        <el-col :span="2" style="margin-top: 4px">
          <advancedSearch ref="advancedSearch" @getRef="getTableRef" @getInquiryResult="getTableInquiryResult" @resetQuery="resetQuery"></advancedSearch>
        </el-col>
        <!-- 快速查询 -->
        <el-col :span="2" style="margin-top: 4px">
          <fastSearch ref="fastSearch" :importDataType="'磁致伸缩性能'" @getFastResult="getTableFastResult" @resetQueryKs="resetQueryKs"></fastSearch>
        </el-col>
        <!-- 导入 -->
        <!-- <el-col :span="2" style="margin-top: 4px">
          <el-button type="primary" size="mini" @click="showImport('磁致伸缩批量导入模板', 0)">导入</el-button>
        </el-col> -->
        <!-- 排序规则 -->
        <el-col :span="4" style="margin-top: 4px">
          <el-select size="mini" v-model="sortValue" @change="selectSort" clearable placeholder="选择排序规则">
            <el-option v-for="item in sortOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
          </el-select>
        </el-col>
        <!-- 自定义列 -->
        <el-col :span="2" :offset="13" style="margin-top: 4px">
          <el-popover  placement="right" width="500" trigger="click" class="tableColumnPopover">
            <div class="tableColumnDiv">
              <div class="top" style="border-bottom: 1px solid #e8e8e8; padding-bottom: 12px; display: flex; align-items: center; justify-content: space-between;">
                <div class="title">自定义列</div>
                <div class="btn">
                  <el-button type="primary" size="mini" slot="reference" @click="defaultTableColumnShow">默认勾选</el-button>
                  <el-button type="primary" size="mini" slot="reference" @click="allTableColumnShow">全部勾选</el-button>
                </div>
              </div>
              <!-- @change="tableColumnShow()" -->
              <div class="content" style="display: flex; justify-content: space-around;">
                <el-checkbox-group v-model="columnShowNameList" :min="1" style="padding: 12px 4px 4px; display: flex; flex-wrap: wrap; width: 45%; flex-direction: column;">
                  <el-checkbox v-for="(item,index) in columnShowList.slice(0, columnHalfNum)" :key="item.value" :label="item.label" :checked="columnShowList[index].isShow" v-model="columnShowList[index].isShow" class="custom-checkbox" @change="tableColumnShow(item)"/>
                </el-checkbox-group>
                <el-checkbox-group v-model="columnShowNameList" :min="1" style="padding: 12px 4px 4px; display: flex; flex-wrap: wrap; width: 45%; flex-direction: column;">
                  <el-checkbox v-for="(item,index) in columnShowList.slice(columnHalfNum, columnShowList.length)" :key="item.value" :label="item.label" :checked="columnShowList[index].isShow" v-model="columnShowList[index].isShow" class="custom-checkbox" @change="tableColumnShow(item)"/>
                </el-checkbox-group>
              </div>
            </div>
            <el-button type="primary" size="mini" slot="reference" @click.once="defaultTableColumnShow">自定义列</el-button>
          </el-popover>
        </el-col>
        <!-- 操作 -->
        <el-col :span="1" style="margin-top: 4px">
          <el-button type="primary" size="mini" @click="operationShow()">操作</el-button>
        </el-col>
      </el-row>
      <el-table ref="ciZhiTable" @sort-change="tableGetSortChange" :data="parameterList" height="500px" style="margin: 10px 0 10px"  @select="parameterSelect" border class="mainTable">
        <el-table-column label-class-name="DisabledSelection" type="selection" fixed="left" width="40"> </el-table-column>
        <el-table-column :key="0" :render-header="renderHeader" label-class-name="sortableShow" sortable="custom" align="center" label="编号" prop="parameterId" show-overflow-tooltip width="90px" v-if="columnShowList[0].isShow"></el-table-column>
        <el-table-column :key="1" :render-header="renderHeader" align="center" label="牌号" prop="grade" show-overflow-tooltip width="100px" v-if="columnShowList[1].isShow"></el-table-column>
        <el-table-column :key="2" :render-header="renderHeader" align="center" label="国别" prop="country" show-overflow-tooltip min-width="4%" v-if="columnShowList[2].isShow"></el-table-column>
        <el-table-column :key="3" :render-header="renderHeader" align="center" label="生产商" prop="manufacturer" show-overflow-tooltip min-width="4%" v-if="columnShowList[3].isShow"></el-table-column>
        <el-table-column :key="4" :render-header="renderHeader" align="center" label="执行标准" prop="standard" show-overflow-tooltip min-width="4%" v-if="columnShowList[4].isShow">
          <template slot-scope="scope">
            <el-button type="text" size="mini" @click.native.stop="downloadAttachment(scope.row.standard)">{{ scope.row.standard }}</el-button>
          </template>
        </el-table-column>
        <el-table-column :key="5" :render-header="renderHeader" align="center" label="样品规格" prop="specification" show-overflow-tooltip min-width="4%" v-if="columnShowList[5].isShow"></el-table-column>
        <el-table-column :key="6" :render-header="renderHeader" sortable="custom" align="center" label="标称密度/(kg/m³)" min-width="4%" prop="nominalDensity" show-overflow-tooltip v-if="columnShowList[6].isShow"></el-table-column>
        <el-table-column :key="7" :render-header="renderHeader" sortable="custom" align="center" label="单片厚度" min-width="4%" prop="thickness" show-overflow-tooltip v-if="columnShowList[7].isShow"></el-table-column>
        <el-table-column :key="8" :render-header="renderHeader" sortable="custom" align="center" label="标称叠压系数" min-width="4%" prop="ratedStackingFactor" show-overflow-tooltip v-if="columnShowList[8].isShow"></el-table-column>
        <el-table-column :key="9" :render-header="renderHeader" sortable="custom" align="center" label="饱和磁密/T" min-width="4%" prop="saturatedInduction" show-overflow-tooltip v-if="columnShowList[9].isShow"></el-table-column>
        <el-table-column :key="10" :render-header="renderHeader" sortable="custom" align="center" label="饱和磁致伸缩系数/ppm" min-width="4%" prop="saturatedMagStriction" show-overflow-tooltip v-if="columnShowList[10].isShow"></el-table-column>
        <el-table-column :key="11" :render-header="renderHeader" sortable="custom" align="center" label="电导率/(S/m)" min-width="4%" prop="electricalConductivity" show-overflow-tooltip v-if="columnShowList[11].isShow"></el-table-column>
        <el-table-column :key="12" :render-header="renderHeader" sortable="custom" align="center" label="热导率/(W/m-k)" min-width="4%" prop="thermalConductivity" show-overflow-tooltip v-if="columnShowList[12].isShow"></el-table-column>
        <el-table-column :key="13" :render-header="renderHeader" sortable="custom" align="center" label="屈服强度/MPa" min-width="4%" prop="yieldStrength" show-overflow-tooltip v-if="columnShowList[13].isShow"></el-table-column>
        <el-table-column :key="14" :render-header="renderHeader" sortable="custom" align="center" label="居里温度/Cel.Deg." min-width="4%" prop="curieTemperature" show-overflow-tooltip v-if="columnShowList[14].isShow"></el-table-column>
        <el-table-column :key="15" :render-header="renderHeader" sortable="custom" align="center" label="入库日期" min-width="4%" prop="inDate" show-overflow-tooltip v-if="columnShowList[15].isShow"></el-table-column>
        <el-table-column :key="16" :render-header="renderHeader" align="center" label="样品柜编号" min-width="4%" prop="cabinetNumber" show-overflow-tooltip v-if="columnShowList[16].isShow"></el-table-column>
        <el-table-column :key="17" :render-header="renderHeader" align="center" label="项目组" prop="projectGroup" min-width="4%" show-overflow-tooltip v-if="columnShowList[17].isShow"></el-table-column>
        <el-table-column :key="18" :render-header="renderHeader" align="center" label="样品提供人" min-width="4%" prop="sampleOffer" show-overflow-tooltip v-if="columnShowList[18].isShow"></el-table-column>
        <el-table-column :key="19" :render-header="renderHeader" align="center" label="数据来源" min-width="4%" prop="dataSource" show-overflow-tooltip v-if="columnShowList[19].isShow">
          <template slot-scope="scope">
            <el-button type="text" size="mini" @click.native.stop="downloadAttachment(scope.row.dataSource)">{{ scope.row.dataSource }}</el-button>
          </template>
        </el-table-column>
        <el-table-column :key="20" :render-header="renderHeader" align="center" label="备注" prop="remarks" show-overflow-tooltip min-width="4%" v-if="columnShowList[20].isShow"></el-table-column>
        <el-table-column :render-header="renderHeader" align="center" fixed="right" label="操作" width="260px" v-if="isOperationShow">
          <template slot-scope="scope">
            <span style="margin-right:13px">
              <el-badge style="margin: 5px 0 0 0" :value="scope.row.supportCount === 0 ? '' : scope.row.supportCount" :max="50" class="item" type="primary">
                <img src="@/assets/iconfile/likeb.png" alt="" v-if="!scope.row.support" @click="forOrAgainst(scope.row, 'like')" />
                <img src="@/assets/iconfile/like.png" alt="" v-else @click="forOrAgainst(scope.row, 'like')" />
              </el-badge>
            </span>
            <el-divider direction="vertical"></el-divider>
            <span style="margin:0 13px 0 13px">
              <el-badge style="margin: 5px 0 0 0" :value="scope.row.againstCount === 0 ? '' : scope.row.againstCount" :max="50" class="item" type="primary">
                <img src="@/assets/iconfile/dislikeb.png" alt="" v-if="!scope.row.against" @click="forOrAgainst(scope.row, 'dislike')" />
                <img src="@/assets/iconfile/dislike.png" alt="" v-else @click="forOrAgainst(scope.row, 'dislike')" />
              </el-badge>
            </span>
            <el-divider direction="vertical"></el-divider>
            <span style="margin:0 13px 0 13px">
              <el-badge style="margin: 5px 0 0 0" :value="scope.row.commentsCount === 0 ? '' : scope.row.commentsCount" :max="50" class="item" type="primary">
                <el-button type="text" size="mini" @click="getComment(scope.row.id)">评论</el-button>
              </el-badge>
            </span>
            <el-divider direction="vertical"></el-divider>
            <span style="margin:0 0 0 13px">
              <el-badge style="margin: 5px 0 0 0" class="item" type="primary">
                <el-button type="text" size="mini" @click="getFocusOn(scope.row)">关注</el-button>
              </el-badge>
            </span>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页区 -->
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="queryInfo.pageNum" :page-sizes="[10, 20]" :page-size="queryInfo.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
    </el-card>

    <el-tabs style="margin-top: 10px" tab-position="top">
      <el-tab-pane label="测量条件">
        <!-- 测量条件卡片视图区域 -->
        <el-card class="box-card" style="margin-top: 10px">
          <div slot="header">
            <span style="color:#4e9efd;font-size:17px;">测量条件</span>
          </div>
          <el-card class="box-card">
            <div slot="header">
              <span>数据类型</span>
            </div>
            <a-row :gutter="24" style="margin-bottom: 5px;display: flex;justify-content: space-between;">
              <el-radio style="width:180px;" v-model="curveDisplayRadio" label="0" border @change="judge('原始波形', '磁致伸缩性能', 0)">原始波形 : {{ conditionNum.原始波形 }}</el-radio>
              <el-radio style="width:180px;" v-model="curveDisplayRadio" label="1" border @change="judge('蝴蝶曲线', '磁致伸缩性能', 1)">蝴蝶曲线 : {{ conditionNum.蝴蝶曲线 }}</el-radio>
              <el-radio style="width:180px;" v-model="curveDisplayRadio" label="2" border @change="judge('磁滞回线', '磁致伸缩性能', 2)">磁滞回线 : {{ conditionNum.磁滞回线 }}</el-radio>
            </a-row>
          </el-card>
          <el-card class="box-card" style="margin-top: 3px">
          <el-row :gutter="20">
            <el-col :span="2"><el-button type="primary" size="mini"  style="width:100px" @click="hideSelect">隐藏选中数据</el-button> </el-col>
            <el-col :span="2"><el-button type="primary" size="mini"  style="width:100px" @click="showAll">全部显示</el-button> </el-col>
          </el-row>
          <u-table use-virtual :row-height="rowHeight"  ref="measureTable"  :data="conditionList" @sort-change="getSortChange" :default-sort="sortRule"  border height="500px" style="margin-top: 10px" @selection-change="addChart">
            <u-table-column  type="selection" width="55"> </u-table-column>
            <u-table-column sortable="custom" align="center" label="裁剪角度/Deg.'" width="160px" prop="cuttingAngle" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="频率/Hz" width="120px" prop="frequency" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="温度/Cel.Deg." width="150px" prop="temperature" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="磁致伸缩系数λpp/ppm" width="200px" prop="mpCoefficient" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="磁致伸缩系数λo-p/ppm" width="200px" prop="moCoefficient" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="谐波次数" width="140px" prop="harmonicFrequency" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="谐波幅度/%" width="140px" prop="harmonicAmplitude" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="谐波相位/°" width="140px" prop="harmonicPhase" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="直流磁密/T" width="140px" prop="dcMagneticDensity" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="交流磁密/T'" width="140px" prop="acMagneticDensity" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="直流磁场/(A/m)" width="150px" prop="dcMagneticField" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="交流磁场/(A/m)" width="150px" prop="acMagneticField" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="消除应力退火" width="180px" prop="stressReliefAnnealing" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="损耗/(J/kg)" width="120px" prop="loss" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="应力/MPa" width="150px" prop="stress" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="测量标准" width="130px" prop="standard" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-button type="text" size="mini" @click.native.stop="downLoadFileName(scope.row.standard)">{{ scope.row.standard }}</el-button>
              </template>
            </u-table-column>
            <u-table-column sortable="custom" align="center" label="测试员" width="100px" prop="testController" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="测量日期" width="130px" prop="testDate" show-overflow-tooltip></u-table-column>
            <u-table-column sortable="custom" align="center" label="备注"  prop="remarks" show-overflow-tooltip></u-table-column>
            <u-table-column align="center" label="文件名" width="100px" prop="fileName" show-overflow-tooltip></u-table-column>
            <u-table-column  align="center" fixed="right" label="操作"  width="100px">
              <template slot-scope="scope">
                <el-button @click="collect(scope.row)" size="mini" type="primary" plain>收藏</el-button>
                <!-- <el-divider direction="vertical"></el-divider>
                <el-button @click="echartsdownload(scope.row)" size="mini" type="primary" plain>下载测试报告</el-button> -->
              </template>
            </u-table-column>
          </u-table>
          <!-- <el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange1" :current-page="pageVo.pageNum" :page-sizes="[10, 20]" :page-size="pageVo.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total1"> </el-pagination> -->
         </el-card>
        </el-card>
        <!-- 图表展示卡片区 -->
        <el-card class="box-card" style="margin-top: 10px">
          <div slot="header">
            <span style="color:#4e9efd;font-size:17px;">图表展示</span>
          </div>
          <div class="toolBar">
            <el-button size="mini" style="width:160px; margin-bottom: 20px" type="primary" v-model="dataZoomType" @click="changeDataZoom(dataZoomType)">切换缩放模式:{{dataZoomType == 'slider' ? '鼠标滚动' : '滑动条'}}</el-button>
          </div>
          <div id="main" :style="`height:${graphHeight}px;width:${graphWidth}px`"></div>
        </el-card>

        <!-- 测量数据卡片区 -->
        <el-card class="box-card" style="margin-top: 10px">
          <div slot="header">
            <span style="color:#4e9efd;font-size:17px;">测量数据</span>
          </div>
          <el-row :gutter="20">
            <el-col :span="2">
              <el-button size="mini" style="width:100px" type="primary" @click="exportMeasureData">txt文件导出</el-button>
            </el-col>
          </el-row>
          <!-- 动态生成表头 -->
          <el-table height="300px" style="margin-top: 10px; width: 50%" border :data="measureList">
            <template v-for="(item, index) in measureHead">
              <el-table-column :prop="item.name" :label="item.label" :key="index" v-if="item.name != 'id'" align="center"></el-table-column>
            </template>
          </el-table>
        </el-card>
      </el-tab-pane>
      <el-tab-pane label="详细信息">
        <measureDetailed ref="measureDetailed"></measureDetailed>
      </el-tab-pane>
      
    </el-tabs>
    <el-dialog :visible.sync="commentDialog" width="60%" :close-on-click-modal="false">
      <!-- 评论区 -->
        <el-input clearable v-model="newComment" placeholder="说的什么......" style="width: 400px; margin-left: 10px" @keyup.enter.native="addNewComment(commentId)"></el-input>
        <el-row :gutter="20" style="margin-top: 20px; margin-bottom: 10px">
          <el-col :span="6" style="font-size: 20px"> 对这条数据的评论 </el-col>
        </el-row>
        <el-divider></el-divider>
        <div v-for="(item, index) in comment" :key="index" style="margin-left: 10px">
          <div>
            <i class="el-icon-user"></i>{{ item.nickname }}：
            {{ item.content }}
            <el-button type="text" :disabled="flag !== -1" @click="replyComment(item.id)"><i class="el-icon-chat-dot-round"></i></el-button>
            <span>{{ item.createTime }}</span>
            <div style="margin-left: 20px">
              <div v-if="flag == item.id">
                @{{ item.nickname }}:
                <el-input v-model="reply" style="width: 200px" @keyup.enter.native="addComment(item)" @blur="showComment"> </el-input>
                <el-button style="margin: 0 10px" type="primary" @click="addComment(item)">发送</el-button>
                <el-button @click="cancelComment">取消</el-button>
              </div>
            </div>
            <el-divider v-if="!item.commentNum"></el-divider>
            <el-divider v-else content-position="left">
              <span @click="foldComment(index)" v-if="isfold[index]" :key="index"
                >展开{{ item.commentNum }}条回复
                <i class="el-icon-caret-bottom"></i>
              </span>
              <span @click="foldComment(index)" v-else :key="index + '1'"
                >收起
                <i class="el-icon-caret-top"></i>
              </span>
            </el-divider>
            <div v-if="!isfold[index]" v-for="(it, index1) in item.replyComments" style="margin-left: 50px" :key="index1">
              <i class="el-icon-user"></i>{{ it.nickname }} 回复 {{it.parentNickname}}： {{ it.content }}
              <el-button type="text" :disabled="flag !== -1" @click="replyComment1(it.id)"><i class="el-icon-chat-dot-round"></i></el-button>
              <span>{{ it.createTime }}</span>
              <div style="margin-left: 20px">
                <div v-if="flag == it.id">
                  @{{ it.nickname }}:
                  <el-input v-model="reply" style="width: 200px" @keyup.enter.native="addComment(it)" @blur="showComment"> </el-input>
                  <el-button style="margin: 0 10px" type="primary" @click="addComment(it)">发送</el-button>
                  <el-button @click="cancelComment">取消</el-button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-card>
    </el-dialog>

    <el-dialog title="提示" :visible.sync="importTag" width="40%">
      <div style="font-size: 20px; margin-left: 40px">请选择导入方式进行导入</div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" style="margin:0 20px" @click="showDataImport">单个导入</el-button>
        <el-divider direction="vertical"></el-divider>
        <el-button type="primary" style="margin:0 20px" @click="batchVisible = true">批量导入</el-button>
        <el-divider direction="vertical"></el-divider>
        <el-button type="primary" style="margin:0 20px" @click="attachmentVisible = true">附件导入</el-button>
      </span>
    </el-dialog>

    <!-- 批量导入弹窗 -->
    <el-dialog title="批量导入--下载模板" :visible.sync="batchVisible" width="40%" :close-on-click-modal="false">
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" style="margin:0 20px" @click="exportData">下载模板</el-button>
        <a-upload name="file" :action="uploadUrl" accept=".xls,.xlsx" :data="paramData" :multiple="true" @change="handleChange" :showUploadList="false">
          <el-button type="primary">已有模板直接导入</el-button>
        </a-upload>
      </span>
    </el-dialog>
    <!-- 批量导入弹窗 -->

    <!-- 附件导入弹窗 -->
    <el-dialog title="附件导入--备注信息" :visible.sync="attachmentVisible" width="40%" :close-on-click-modal="false">
      <div style="margin-bottom: 15px">支持测试数据、测量仪器、文献、标准、产品手册等导入</div>
      <el-input v-if="attachmentVisible" v-model="attachmentParamData.remark"></el-input>
      <span slot="footer" class="dialog-footer">
        <a-upload name="file" :action="attachmentUploadUrl" :data="attachmentParamData" :headers="attachmentHeaders" :multiple="true" @change="attHandleChange" :showUploadList="false">
          <el-button type="primary" @click="attachmentVisible = false">确 定</el-button>
        </a-upload>
      </span>
    </el-dialog>
    <!-- 附件导入弹窗 -->

    <!-- 单个导入弹窗 -->
    <singleImport ref="singleImport" :importDataType="'磁致伸缩'"></singleImport>
    <!-- 单个导入弹窗 -->

    <!-- 收藏弹窗 -->
    <el-dialog title="收藏" :visible.sync="collectVisible" width="40%" :show-close="false" :close-on-click-modal="false">
      <el-row :gutter="20">
        <el-col> 补充信息： <el-input type="textarea" autosize placeholder="请输入补充信息" style="width: 80%" v-model="collectinSupplement"> </el-input> </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" size="small" style="margin-right: 20px" @click="confirmCollect()">确认收藏</el-button>
        <el-button type="danger" size="small" style="margin-right: 20px" @click="closeCollect()">关闭</el-button>
      </span>
    </el-dialog>
    <!-- 收藏弹窗 -->

    <!-- 关注弹窗 -->
    <el-dialog title="关注" :visible.sync="focusOnVisible" width="30%" :show-close="false" :close-on-click-modal="false">
      <a-radio-group v-model="value" @change="getRadioValue">
        <div>
          <span>牌号：</span>
          <a-radio :value="focusOnValue.grade">{{ focusOnLabel.grade }}</a-radio>
        </div>

        <br />
        <div>
          <span>样品规格：</span>
          <a-radio :value="focusOnValue.specification">{{ focusOnLabel.specification }}</a-radio>
        </div>
        <br />
        <div>
          <span>国别：</span>
          <a-radio :value="focusOnValue.country">{{ focusOnLabel.country }}</a-radio>
        </div>
        <br />
        <div>
          <span>生产商：</span>
          <a-radio :value="focusOnValue.manufacturer">{{ focusOnLabel.manufacturer }}</a-radio>
        </div>
        <br />
        <div>
          <span>执行标准：</span>
          <a-radio :value="focusOnValue.standard">{{ focusOnLabel.standard }}</a-radio>
        </div>
        <br />
      </a-radio-group>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" size="small" style="margin-right: 20px" @click="confirmFocusOn()">确认关注</el-button>
        <el-button type="danger" size="small" style="margin-right: 20px" @click="closeFocusOn()">关闭</el-button>
      </span>
    </el-dialog>
    <!-- 关注弹窗 -->

    <!-- 拟合弹窗 -->
    <el-dialog title="曲线拟合" :visible.sync="curveFittingVisible" width="90%" :show-close="false" :close-on-click-modal="false">
      <div style="display: flex;">
        <el-card style="width: 35%; margin: 0 5px 0 0;height:750px;" shadow="hover">
          <div style="width:30%; margin: 0 5px 0 0;height:750px;float:left;" hidden="true">
            <el-card style="margin-bottom: 7px;">
              <div slot="header">
                <span style="font-size: 16px;">模型名称</span>
              </div>
              <el-select v-model="curveFittingParams.modelName" placeholder="请选择模型名称">
                <el-option v-for="item in modelNameOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
              </el-select>
            </el-card>
            <el-card style="margin-bottom: 7px;">
              <div slot="header">
                <span style="font-size: 16px;margin-right: 10px;">拟合方法</span>
                <el-tooltip placement="right" content="由于遗传算法计算时间很长，故不提供计算遗传算法功能！">
                  <el-button type="text" size="medium" style="padding-top: 5px"><i class="el-icon-warning-outline"></i></el-button>
                </el-tooltip>
              </div>
              <el-radio v-model="curveFittingParams.fittingMethod" label="模式搜索法" style="margin-bottom: 18px;">模式搜索法</el-radio><br />
              <el-radio v-model="curveFittingParams.fittingMethod" disabled label="遗传算法" style="margin-bottom: 18px;">遗传算法</el-radio><br />
              <el-radio v-model="curveFittingParams.fittingMethod" label="模拟退火法">模拟退火法</el-radio>
            </el-card>
            <el-card style="margin-bottom: 7px;">
              <div slot="header">
                <span style="font-size: 16px;">目标函数</span>
              </div>
              <el-radio v-model="curveFittingParams.objectiveFunction" label="绝对误差" style="margin-bottom: 18px;">绝对误差</el-radio><br />
              <el-radio v-model="curveFittingParams.objectiveFunction" label="相对误差">相对误差</el-radio>
            </el-card>
            <el-card>
              <div slot="header">
                <span style="font-size: 16px;">模型误差</span>
              </div>
              <el-table :data="modelErrorData" style="width: 100%" border stripe header-align="center" :show-header="false">
                <el-table-column prop="date" show-overflow-tooltip> </el-table-column>
              </el-table>
            </el-card>
          </div>
          <div style="width:100%;float:left;">
            <el-card style="margin-bottom: 20px;">
              <div slot="header">
                <span style="font-size: 16px;">模型参数</span>
              </div>
              <el-table :data="modelParametersData" style="width: 100%" height="550px" border stripe header-align="center">
                <el-table-column type="index" width="50"> </el-table-column>
                <el-table-column prop="name" label="变量名" align="center" width="70" show-overflow-tooltip> </el-table-column>
                <el-table-column prop="unit" label="单位" align="center" width="70" show-overflow-tooltip> </el-table-column>
                <el-table-column prop="chineseNotes" label="中文注释" align="center" show-overflow-tooltip> </el-table-column>
                <el-table-column prop="value" label="值" align="center" show-overflow-tooltip> </el-table-column>
              </el-table>
            </el-card>
          </div>
          <div style="width:100%;float:left;">
            <el-row :gutter="20">
              <el-col :span="6"><el-button @click="startFitting()">开始拟合</el-button></el-col>
              <el-col :span="6"><el-button @click="saveParameters()">数据导出</el-button></el-col>
              <el-col :span="6"><el-button @click="modelDescription()">模型说明</el-button></el-col>
            </el-row>
          </div>
        </el-card>
        <el-card style="width: 65%; margin: 0 5px 0 5px;height:750px;" shadow="hover">
          <div id="fittingMain" style="height:550px;width:100%"></div>
        </el-card>
      </div>
      <span slot="footer" class="dialog-footer">
        <!-- <el-button type="primary" size="small" style="margin-right: 20px" @click="confirmCurveFitting()">确认</el-button> -->
        <el-button type="danger" size="small" style="margin-right: 20px" @click="closeCurveFitting()">关闭</el-button>
      </span>
    </el-dialog>
    <!-- 拟合弹窗 -->
  </div>
</template>

<script>
import * as echarts from 'echarts'
import { Message } from 'element-ui'
import advancedSearch from './components/advancedSearch.vue'
import fastSearch from './components/fastSearch.vue'
import singleImport from './components/singleImport.vue'
import categoryFilter from './components/categoryFilter.vue'
import measureDetailed from './components/measureDetailed.vue'

export default {
  components: {
    advancedSearch,
    fastSearch,
    measureDetailed,
    singleImport,
    categoryFilter
  },
  data() {
    return {
      /*************** 操作部分 *********************/
      isOperationShow: false,
      /*************** 操作部分 *********************/
      rowHeight: 55,
      commentId: '', //评论ID
      importDataType: '磁致伸缩性能', //传入子组件进行判断
      currentCheckedNum: '',
      timer: '',
      /*************** 测量条件排序 *********************/
      sortRule: { prop: null, order: null },
      sortType: null,
      sortProp: '',
      oldTableData: [],
      hideSelection: [],
      chartSpecification: '',
      /*************** 测量条件排序 *********************/

      /*************** 曲线拟合 *********************/
      dataZoomType: 'slider',
      curveFittingVisible: false,
      currentFitting: [],
      modelNameOptions: [
        {
          value: 'Bertotti',
          label: 'Bertotti',
        },
      ],
      curveFittingParams: {
        modelName: '',
        fittingMethod: '',
        objectiveFunction: '',
      },
      modelErrorData: [
        {
          date: '绝对误差',
        },
        {
          date: '相对误差',
        },
      ],
      modelParametersData: [],
      fittingOption: {
        toolbox: {
          show: true,
          feature: {
            saveAsImage: {},
          },
        },
        legend: {
          icon: 'none',
          textStyle: {
            color: 'inherit',
          },
          data: [],
        },
        tooltip: {
          confine: true,
          formatter: (params, ticket, callback) => {
            if (params.componentIndex % 2 == 0) {
              //偶数-■-
              return '电密测量值/A/m^2:' + params.data[0] + `<br />` + '电阻率测量值/ohm.m:' + params.data[1]
            } else {
              //奇数-○-
              return '电密测量值/A/m^2:' + params.data[0] + `<br />` + '电阻率拟合值/ohm.m:' + params.data[1]
            }
          },
        },
        dataZoom: [
          {
            disabled: false,
            id: 'dataZoomX',
            type: 'slider',
            // top: 'bottom',
            xAxisIndex: [0],
            filterMode: 'empty',
          },
          {
            disabled: false,
            id: 'dataZoomY',
            type: 'slider',
            yAxisIndex: [0],
            filterMode: 'empty',
          },
        ],
        xAxis: {
          type: 'value',
          name: '电密测量值/A/m^2',
          scale: true,
          nameTextStyle: {
            fontsize: 100,
            fontWeight: 'bold',
            padding: [20, 0, 0, 0],
          },
          nameLocation: 'middle',
        },
        yAxis: [
          {
            type: 'log',
            logBase: 10,
            minorSplitLine: {
              show: true,
            },
            name: '电阻率测量值/ohm.m  -○-',
            scale: true,
            position: 'left',
            nameTextStyle: {
              fontsize: 100,
              fontWeight: 'bold',
              padding: [0, 0, 15, 0],
            },
            nameLocation: 'middle',
          },
          {
            type: 'log',
            logBase: 10,
            minorSplitLine: {
              show: true,
            },
            name: '电阻率拟合值/ohm.m  -■-',
            scale: true,
            position: 'right',
            axisLine: {
              show: true,
            },
            nameTextStyle: {
              fontsize: 100,
              fontWeight: 'bold',
              padding: [0, 0, 15, 0],
            },
            nameLocation: 'middle',
          },
        ],
        series: [],
      },
      /*************** 曲线拟合 *********************/

      /*************** 排序规则 *********************/
      sort: '/null',
      sortOptions: [
        {
          value: '/null',
          label: '常规排序',
        },
        {
          value: '/support',
          label: '按点赞数量降序排序',
        },
        {
          value: '/against',
          label: '按踩数量降序排序',
        },
        {
          value: '/comment',
          label: '按评论数量降序排序',
        },
      ],
      sortValue: '',
      /*************** 排序规则 *********************/

      /*************** 关注 *********************/
      focusOnVisible: false,
      value: '',
      focusOnImportData: {
        userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id,
        content: '',
        property: '',
      },
      focusOnLabel: {
        grade: '',
        specification: '',
        country: '',
        manufacturer: '',
        standard: '',
      },
      focusOnValue: {
        grade: '',
        specification: '',
        country: '',
        manufacturer: '',
        standard: '',
      },
      /*************** 关注 *********************/

      /******************** 收藏 ************************/
      collectVisible: false,
      collectinformation: {},
      collectinSupplement: '',
      /******************** 收藏 ************************/
      ciZhiTableRow: {},
      exportMeasureDataId: '',
      xAxisName: '',
      yAxisName: '',
      yAxisAnotherName: '',
      graphWidth: 1350,
      graphHeight: 600,
      GraphOption: {
        toolbox: {
          show: true,
          feature: {
            dataView: { readOnly: false },
            // restore: {},
            saveAsImage: {},
          },
        },
        dataZoom: [
          {
            disabled: false,
            id: 'dataZoomX',
            type: 'slider',
            // top: 'bottom',
            xAxisIndex: [0],
            filterMode: 'empty',
          },
          {
            disabled: false,
            id: 'dataZoomY',
            type: 'slider',
            yAxisIndex: [0],
            filterMode: 'empty',
          },
        ],
        grid: [{ top: 40 , bottom: 100 }], //大概每个legend增加20
        legend: {
          icon: 'none',
          textStyle: {
            color: 'inherit',
          },
          // left: '15%',
          // right: '15%',
          data: [],
          formatter: function (name) {
            return echarts.format.truncateText(name, 1000, '14px Microsoft Yahei', '…')
          },
          tooltip: {
            confine: true,
            show: true,
            formatter: (params, ticket, callback) => {
              let paramsSplit = params.name.split(',')
              let paramsBack = paramsSplit
                .map((x) => {
                  return x + `<br />`
                })
                .join('') //这里使用join('')是为了祛除map遍历添加的逗号
              return paramsBack
            },
          },
        },
        tooltip: {
          confine: true,
          formatter: (params, ticket, callback) => {
            if (params.componentIndex % 2 == 0) {
              //偶数-■-
              return this.xAxisName + ':' + params.data[0] + `<br />` + this.yAxisName + ':' + params.data[1]
            } else {
              //奇数-○-
              return this.xAxisName + ':' + params.data[0] + `<br />` + this.yAxisAnotherName + ':' + params.data[1]
            }
          },
        },
        xAxis: {
          name: '',
          // boundaryGap: ['10%', '10%'],
          // max: 'dataMax',
          scale: true,
          nameTextStyle: {
            color: 'skyblue',
            padding: [5, 0, 0, 0],
          },
          nameLocation: 'middle',
          axisLine: {
            onZero: false,
          },
        },
        yAxis: [
          {
            name: '',
            scale: true,
            // boundaryGap: ['1', '2'],
            position: 'left',
            nameTextStyle: {
              color: 'green',
            },
            axisLine: {
              onZero: false,
            },
          },
          {
            name: '',
            // show: false,
            scale: true,
            position: 'right',
            nameTextStyle: {
              color: 'green',
            },
            axisLine: {
              onZero: false,
            },
          },
        ],
        series: [],
      },
      measureHead: [], //动态生成表头
      fileFlag: 0,
      //downFileName:['供应商标签','软磁动态磁化曲线测量条件表','软磁动态磁滞回线测量条件表','供应商信息','牌号标签','化学成分表信息','软磁动态原始波形测量条件表','软磁动态铁损曲线测量条件表','软磁静态磁化曲线测量条件表','软磁静态铁损曲线测量条件表','软磁静态磁滞回线测量条件表','软磁静态原始波形测量条件表','相同相近牌号','执行标准标签','软磁样品基本参数'],
      downFileName: ['磁致伸缩批量导入模板', '国内外相同牌号', '材料标签', '化学成分', '生产商', '生产商标签', '样品规格参数', '测试仪器信息', '磁致伸缩批量导入模板'],
      paramData: {
        type: '磁致伸缩样品基本参数',
        userId: JSON.parse(window.localStorage.getItem('pro__Login_Userinfo')).value.id,
      },
      attachmentParamData: {
        type: '磁致伸缩样品基本参数',
        remark: '',
      },
      attachmentHeaders: {
        userId: JSON.parse(window.localStorage.getItem('pro__Login_Userinfo')).value.id,
        username: JSON.parse(window.localStorage.getItem('pro__Login_Userinfo')).value.username,
      },
      uploadUrl: 'http://59.172.104.174:30669/user/uploadMeasurementByUser', //上传文件路径
      attachmentUploadUrl: 'http://59.172.104.174:30669/user/uploadFile', //附件导入上传路径
      batchVisible:false,
      attachmentVisible: false,
      conditionNum: {},
      likePNG: '@/assets/iconfile/like3.png',
      likeflag: true, //未点赞
      dislikeflag: true, //未踩
      starflag: false, //未收藏
      commentDialog: false,
      sampleSize: '',
      tableVisiable: [0, 0, 0, 0, 0, 0, 0, 0],
      relation: '',
      relationOptions: [
        {
          label: '所有条件都要满足',
          value: 'AND',
        },
        {
          label: '满足任意一个条件',
          value: 'OR',
        },
      ],
      QueryLength: [''],
      fieldValue: [''],
      compara: [''],
      comparaOptions: [
        {
          value: '等于',
          label: '等于',
        },
        {
          value: '包含',
          label: '包含',
        },
        // {
        //   value: '以...开始',
        //   label: '以...开始',
        // },
        // {
        //   value: '以...结尾',
        //   label: '以...结尾',
        // },
        {
          value: '不等于',
          label: '不等于',
        },
        {
          value: '大于',
          label: '大于',
        },
        {
          value: '大于等于',
          label: '大于等于',
        },
        {
          value: '小于',
          label: '小于',
        },
        {
          value: '小于等于',
          label: '小于等于',
        },
      ],
      comparaCondition: [
        [
          {
            value: '等于',
            label: '等于',
          },
          {
            value: '包含',
            label: '包含',
          },
          // {
          //   value: '以...开始',
          //   label: '以...开始',
          // },
          // {
          //   value: '以...结尾',
          //   label: '以...结尾',
          // },
          {
            value: '不等于',
            label: '不等于',
          },
          {
            value: '大于',
            label: '大于',
          },
          {
            value: '大于等于',
            label: '大于等于',
          },
          {
            value: '小于',
            label: '小于',
          },
          {
            value: '小于等于',
            label: '小于等于',
          },
        ],
      ],
      selectedHeader: [''],
      headeroptions: [],
      headerCondition: [

      ],
      chartList: [],
      showQueryDialog: false,
      //评论部分
      isfold: [],
      newComment: '', //新的评论
      flag: -1,
      foldFlag: [],
      reply: '', //评论回复
      comment: [
        {
          name: '巡山啦',
          time: '2021-04-15 17:23',
          content: '这个不错哟！',
          commentNum: 0,
        },
        {
          name: '雷伟',
          time: '2021-04-15 17:23',
          content: '这个不错哟！',
          commentNum: 2,
          children: [
            {
              name: '冬哥',
              time: '2021-04-15 17:26',
              content: '雷伟说的对！',
            },
            {
              name: '向钊',
              time: '2021-04-15 17:29',
              content: '我顶！！！',
            },
          ],
        },
        {
          name: '雷伟',
          time: '2021-04-15 17:23',
          content: '这个有点问题呀',
          commentNum: 1,
          children: [
            {
              name: '小明',
              time: '2021-04-15 17:26',
              content: '是的，这条数据有问题',
            },
          ],
        },
      ],
      //控制图表的显示和隐藏
      showChart: false,
      // 指定图表的配置项和数据
      measureList: [],
      //原始波形坐标轴
      yx: 'time/s',
      yy: 'B/T、λp-p/ppm',
      //蝴蝶曲线坐标轴
      dx: 'B/T',
      dy: 'λp-p/ppm',
      //磁致伸缩回线坐标轴
      hx: 'H/(A/m)',
      hy: 'B/T',
      Xname: '', //x轴
      Yname: '', //y轴
      conditionList: [],
      tempDatalist: [],
      dataHideNum: 0,
      /***详细信息****/
      sameCountry: {
        german: '',
        england: '',
        brazil: '',
        japan: '',
        india: '',
        america: '',
        eu: '',
        korea: '',
        taiwan: '',
        china: '',
        russia: '',
        turkey: '',
        luxembourg: '',
        franch: '',
        italy: '',
      },
      materialLabel: [],
      chemical: {
        nickel: '',
        chromium: '',
        ferrum: '',
        anadium: '',
        titanium: '',
        cobalt: '',
        manganese: '',
        silicon: '',
        carbon: '',
        aluminium: '',
        sulfur: '',
        cuprum: '',
        phosphorus: '',
        molybdenum: '',
      },
      producerDetail: {
        producer: '',
        country: '',
        address: '',
        email: '',
        website: '',
        telephone: '',
        fax: '',
        staff: '',
        remarks: '',
      },
      producerLabel: [],
      simpleSizeOptions: [],
      measureInstrument: [],
      /***详细信息****/
      producer: '',
      mark: '',
      country: '',
      selectNum: '',
      condition: '',
      content: '',
      material: '',
      manufacturer: '',
      curve: '',
      display: '',

      total: 10,
      total1: 10,
      queryInfo: {
        pageNum: 1,
        pageSize: 10,
        userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id,
      },
      primaryTableSort: {
        content: 'parameterId',
        sortOrder: 'DASC'
      },
      queryNum: 1,
      advancedSearchData: {
        queryArray: [],
        andOr: ''
      },
      fastSearchData: {
        content: ''
      },
      //测量条件分页
      pageVo: {
        //当前的页数
        pageNum: 1,
        //当前每页显示多少条数据
        pageSize: 10,
      },
      curveDisplayRadio: '',
      conditionInfo: {
        curveTypes: '',
        timeTypes: '',
        productId: '',
      },
      curveType: -1,
      importParamter: {
        //导入一行对话框的数据
        id: '', //主键
        grade: '', //牌号
        specification: '', //样品规格
        country: '', //国别
        standard: '', //执行标准
        manufacturer: '', //生产商
        nominalDensity: '', //标称密度/(kg/m³)
        specificConductance: '', //电导率/(S/m)
        heatConductivity: '', //热导率/(W/m-k)
        yieldStrength: '', //屈服强度/MPa
        projuctGroup: '', //项目组
        cabinetNumber: '', //样品柜编号
        sampleProducer: '', //样品提供人
        inDate: '', //入库日期
        remarks: '', //备注
        state: '', //是否已经审核
      },
      parameterList: [],
      message: {
        name: '',
        time: '',
        content: '',
        dataId: '', //数据id
        parentId: '', //父级id
      },
      supplierList: [],
      standardList: [],
      sizeList: [],
      producerLabel: [],
      importTag: false,
      importflag: '',
      /*************** 表格列隐藏 *********************/
      columnShowNameList: [],
      // 写死了 涉及修改太多了
      columnShowList: [
        {
            "value": "parameterId",
            "label": "编号",
            "isShow": true,
        },
        {
            "value": "grade",
            "label": "牌号",
            "isShow": true,
        },
        {
            "value": "country",
            "label": "国别",
            "isShow": true,
        },
        {
            "value": "manufacturer",
            "label": "生产商",
            "isShow": true,
        },
        {
            "value": "standard",
            "label": "执行标准",
            "isShow": true,
        },
        {
            "value": "specification",
            "label": "样品规格",
            "isShow": true,
        },
        {
            "value": "nominalDensity",
            "label": "标称密度/(kg/m³)",
            "isShow": true,
        },
        {
            "value": "thickness",
            "label": "单片厚度",
            "isShow": true,
        },
        {
            "value": "ratedStackingFactor",
            "label": "标称叠压系数",
            "isShow": true,
        },
        {
            "value": "saturatedInduction",
            "label": "饱和磁密/T",
            "isShow": true,
        },
        {
            "value": "saturatedMagStriction",
            "label": "饱和磁致伸缩系数/ppm",
            "isShow": true,
        },
        {
            "value": "electricalConductivity",
            "label": "电导率/(S/m)",
            "isShow": false,
        },
        {
            "value": "thermalConductivity",
            "label": "热导率/(W/m-k)",
            "isShow": false,
        },
        {
            "value": "yieldStrength",
            "label": "屈服强度/MPa",
            "isShow": false,
        },
        {
            "value": "curieTemperature",
            "label": "居里温度/Cel.Deg.",
            "isShow": false,
        },
        {
            "value": "inDate",
            "label": "入库日期",
            "isShow": true,
        },
        {
            "value": "cabinetNumber",
            "label": "样品柜编号",
            "isShow": false,
        },
        {
            "value": "projectGroup",
            "label": "项目组",
            "isShow": false,
        },
        {
            "value": "sampleOffer",
            "label": "样品提供人",
            "isShow": false,
        },
        {
            "value": "dataSource",
            "label": "数据来源",
            "isShow": true,
        },
        {
            "value": "remarks",
            "label": "备注",
            "isShow": false,
        }
      ],
      /*************** 表格列隐藏 *********************/
    }
  },
  mounted() {
    // this.drawChart()
    // this.getTableColumn()
  },
  created() {
    this.loadData()
    Message({
      message: '需勾选某条具体数据，才可查看下方测量条件和详细信息！',
      type: 'warning',
      center: true,
      customClass: 'myMessageClass'
    })
  },
  computed: {
    columnHalfNum() {
      return this.columnShowList.length % 2 == 0 ? this.columnShowList.length/2 : this.columnShowList.length/2 + 1
    }
  },
  methods: {
    tableGetSortChange(column) {
      if (column.order == 'ascending') {
        this.primaryTableSort.content = column.prop
        this.primaryTableSort.sortOrder = 'ASC'
      } else if (column.order == 'descending') {
        this.primaryTableSort.content = column.prop
        this.primaryTableSort.sortOrder = 'DASC'
      } else if (column.order == null) {
        this.primaryTableSort.content = 'parameterId'
        this.primaryTableSort.sortOrder = 'ASC'
      }
      this.loadData()
    },
    downloadAttachment(dataName) {
      console.log('dataName----', dataName)
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/attachmentUpload/downLoadAttachmentFile',
        method: 'GET',
        params: {
          filename: dataName
        },
        responseType: 'blob' // 表明返回服务器返回的数据类型
      }).then(res => {
        let blob = new Blob([res.data])
        let fileName = dataName
        if (window.navigator.msSaveOrOpenBlob) {
          navigator.msSaveBlob(blob, fileName)
        } else {
          var link = document.createElement('a')
          link.href = window.URL.createObjectURL(blob)
          link.download = fileName
          link.click()
          //释放内存
          window.URL.revokeObjectURL(link.href)
        }
      })
    },
    downLoadFileName(dataName) {
      console.log('dataName', dataName)
      if(dataName == '未知' || dataName == '') {
        Message({
          message: '数据库暂未收录该消息，欢迎使用附件上传',
          type: 'warning',
          center: true,
          customClass: 'mzindex',
        })
        return
      }
      this.axios({
        baseURL: 'http://59.172.104.174:31770',
        url: '/basicsExecutionStandard/getFilenameByNumber',
        method: 'GET',
        params: {
          number: dataName
        },
      }).then(res => {
        console.log('res----', res.data.result.filename)
        if(res.data.result.filename != '' && res.data.result.filename != null){
          this.downloadAttachment(res.data.result.filename)
        } else {
          Message({
            message: '数据库暂未收录该消息，欢迎使用附件上传',
            type: 'warning',
            center: true,
            customClass: 'mzindex',
          })
        }
      })
    },
    /*************** 隐藏选中的测量数据 *********************/
    hideSelect() {
    if(this.hideSelection.length){
      for (let i = 0; i < this.hideSelection.length; i++) {
        for (let j = 0; j < this.conditionList.length; j++) {
          if (this.hideSelection[i].id == this.conditionList[j].id) {
            this.conditionList.splice(j, 1)
            break
          }
        }
      }
      for (let i = 0; i < this.hideSelection.length; i++) {
        for (let j = 0; j < this.oldTableData.length; j++) {
          if (this.hideSelection[i].id == this.oldTableData[j].id) {
            this.oldTableData.splice(j, 1)
            break
          }
        }
      }
      this.$refs.measureTable.clearSelection()
      this.dataHideNum = 1
      Message({
        message: '隐藏成功！',
        type: 'success',
        center: true,
        customClass: 'mzindex',
      })
    }else{
      Message({
        message: '请先勾选测量条件数据！',
        type: 'warning',
        center: true,
        customClass: 'mzindex',
      })
    }
    },

    showAll() {
      if (this.dataHideNum == 0) {
        Message({
          message: '当前没有隐藏掉的数据！',
          type: 'warning',
          center: true,
          customClass: 'mzindex'
        })
      } else {
        this.conditionList = JSON.parse(JSON.stringify(this.tempDatalist))
        this.oldTableData = JSON.parse(JSON.stringify(this.tempDatalist))
        this.dataHideNum = 0
        Message({
          message: '全部显示成功！',
          type: 'success',
          center: true,
          customClass: 'mzindex'
        })
      }
    },
    /*************** 隐藏选中的测量数据 *********************/

    /*************** 测量条件排序 *********************/
    getSortChange(column) {
      console.log('12121212', column)
      if (column.order !== null) {
        this.sortType = column.order
      } else if (this.sortType !== null && column.order === null) {
        this.sortType = null
      }
      this.sortProp = column.prop
      var prop = column.prop
      if (column.order !== null) {
        const data = []
        for (let i = 0; i < this.conditionList.length; i++) {
          //判断如果是空的push在数字后面，有值的就放在前面，然后把排好的数组再赋值给表格data
          if (this.conditionList[i][prop] === null || this.conditionList[i][prop] === '' || this.conditionList[i][prop] === undefined) {
            console.log('11111')
            data.push(this.conditionList[i]) //往数组最后面添加
          } else {
            data.unshift(this.conditionList[i]) //往数组最前面添加
          }
        }
        // 自定义排序方法  过滤掉 null undefined '' 等空值
        // 此排序有一个小问题，就是对于其中混入的例如“未知”等中文字，在降序的时候会被排在最上方
        data.sort((a, b) => {
          if (a[prop] === b[prop]) {
            return 0
          } else if (a[prop] === null || a[prop] === '' || a[prop] === undefined) {
            return 1
          } else if (b[prop] === null || b[prop] === '' || b[prop] === undefined) {
            return -1
          } else if (column.order === 'ascending') {
            // 升序
            return a[prop] - b[prop]
          } else {
            // 降序
            return b[prop] - a[prop]
          }
        })
        this.conditionList = data
      } else {
        this.conditionList = JSON.parse(JSON.stringify(this.oldTableData))
      }
    },
    /*************** 测量条件排序 *********************/

    /*************** 曲线拟合 *********************/
    curveFitting() {
      if (this.hideSelection.length < 2) {
        Message({
          message: '请先勾选两个测量数据再进行曲线拟合！',
          type: 'warning',
          center: true,
          customClass: 'mzindex',
        })
      } else {
        this.currentFitting = []
        this.currentFitting = this.hideSelection
        this.curveFittingVisible = true
      }
    },
    closeCurveFitting() {
      this.curveFittingVisible = false
      this.modelParametersData = []
      this.fittingChart.dispose()
    },
    startFitting() {
      let linearDataList = []
      this.currentFitting.forEach((item) => {
        let obj = {
          measurementId: item.id,
          temperature: item.temperature,
        }
        linearDataList.push(obj)
      })
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/Linear',
        method: 'POST',
        data: { linearDataList },
      }).then((res) => {
        console.log('resres', res)
        this.fittingOption.series = []
        this.fittingOption.legend.data = []
        // 参数模型表数据处理
        this.modelParametersData = []
        for (let i = 0; i < res.data.result.property.length; i++) {
          let obj = {
            name: res.data.result.property[i],
            unit: '',
            chineseNotes: '',
            value: res.data.result.content[i],
          }
          this.modelParametersData.push(obj)
        }
        // echarts图x,y轴名称处理
        this.fittingOption.xAxis.name = res.data.result.name[1]
        this.fittingOption.yAxis[0].name = res.data.result.name[2]
        this.fittingOption.yAxis[1].name = res.data.result.name[3]
        // echarts图数据处理

        var arrayOne = []
        var isTempOne = res.data.result.result[0][0]
        var nameTitleOne = ''
        for (let i = 0; i < res.data.result.result.length; i++) {
          var sonArrayOne = []
          if (res.data.result.result[i][0] == isTempOne) {
            sonArrayOne[0] = res.data.result.result[i][1]
            sonArrayOne[1] = res.data.result.result[i][2]
            arrayOne.push(sonArrayOne)
            if (i == res.data.result.result.length - 1) {
              nameTitleOne = '牌号:' + this.ciZhiTableRow.grade + '; 温度/Cel.Deg:' + isTempOne + '℃; 测量值'
              this.fittingOption.series.push({
                name: nameTitleOne,
                data: arrayOne,
                type: 'line',
                smooth: false,
              })
              this.fittingOption.legend.data.push(nameTitleOne)
              this.fittingOption.legend.data.push('\n')
            }
          } else if (res.data.result.result[i][0] != isTempOne) {
            nameTitleOne = '牌号:' + this.ciZhiTableRow.grade + '; 温度/Cel.Deg:' + isTempOne + '℃; 测量值'
            this.fittingOption.series.push({
              name: nameTitleOne,
              data: arrayOne,
              type: 'line',
              smooth: false,
            })
            this.fittingOption.legend.data.push(nameTitleOne)
            this.fittingOption.legend.data.push('\n')
            arrayOne = []
            isTempOne = res.data.result.result[i][0]
            i--
          }
        }

        var arrayTwo = []
        var isTempTwo = res.data.result.result[0][0]
        var nameTitleTwo = ''
        for (let i = 0; i < res.data.result.result.length; i++) {
          var sonArrayTwo = []
          if (res.data.result.result[i][0] == isTempTwo) {
            sonArrayTwo[0] = res.data.result.result[i][1]
            sonArrayTwo[1] = res.data.result.result[i][3]
            arrayTwo.push(sonArrayTwo)
            if (i == res.data.result.result.length - 1) {
              nameTitleTwo = '牌号:' + this.ciZhiTableRow.grade + '; 温度/Cel.Deg:' + isTempTwo + '℃; 拟合值'
              this.fittingOption.series.push({
                name: nameTitleTwo,
                data: arrayTwo,
                type: 'line',
                smooth: false,
              })
              this.fittingOption.legend.data.push(nameTitleTwo)
              this.fittingOption.legend.data.push('\n')
            }
          } else if (res.data.result.result[i][0] != isTempTwo) {
            nameTitleTwo = '牌号:' + this.ciZhiTableRow.grade + '; 温度/Cel.Deg:' + isTempTwo + '℃; 拟合值'
            this.fittingOption.series.push({
              name: nameTitleTwo,
              data: arrayTwo,
              type: 'line',
              smooth: false,
            })
            this.fittingOption.legend.data.push(nameTitleTwo)
            this.fittingOption.legend.data.push('\n')
            arrayTwo = []
            isTempTwo = res.data.result.result[i][0]
            i--
          }
        }

        this.fittingChart = echarts.init(document.getElementById('fittingMain'))
        this.fittingChart.setOption(this.fittingOption)
      })
    },
    saveParameters() {},
    modelDescription() {},
    /*************** 曲线拟合 *********************/

    /*---------------------echarts转图片传后端并接受后端文件流下载文件--------------------- */
    echartsdownload(row) {
      Message({
        message: '程序员正在加班中！',
        center: true,
        customClass: 'myMessageClass'
      })
      return
      if (this.currentCheckedNum == 1) {
        if (row.id !== this.hideSelection[0].id) {
          Message({
            message: '请点击已勾选数据的下载测试报告按钮！',
            type: 'warning',
            center: true,
            customClass: 'mzindex'
          })
        } else {
        this.GraphOption && this.myChart.setOption(this.GraphOption, true)
        /****** 加载等待函数 *******/
        this.loading = this.$loading({
          lock: true,
          text: 'Loading',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)',
        })
        /****** 加载等待函数 *******/
        this.timer = setTimeout(() => {
          let dataURL = this.myChart.getDataURL()
          let a = document.createElement('a')
          a.setAttribute('href', dataURL)
          a.setAttribute('download', 'echarts图片下载.png')
          // a.click()
          this.UpBase64Img(dataURL, row)
        }, 1500)
        }
      } else if (this.currentCheckedNum == 0) {
        Message({
          message: '请先勾选数据生成图表，再下载测试报告',
          type: 'warning',
          center: true,
          customClass: 'mzindex',
        })
      } else {
        Message({
          message: '请先取消多选，再下载测试报告',
          type: 'warning',
          center: true,
          customClass: 'mzindex',
        })
      }
    },
    //base64编码图片转换成file对象
    dataURLtoFile(dataurl, filename) {
      var arr = dataurl.split(',')
      var mime = arr[0].match(/:(.*?);/)[1] //base64解析出来的图片类型
      var bstr = atob(arr[1]) //对base64串进行操作，去掉url头，并转换为byte   atob为window内置方法
      var n = bstr.length
      var u8arr = new Uint8Array(n)
      while (n--) {
        u8arr[n] = bstr.charCodeAt(n)
      }
      // 创建新的 File 对象实例[utf-8内容，文件名称或者路径，[可选参数，type：文件中的内容mime类型]]
      return new File([u8arr], filename, { type: mime })
    },
    UpBase64Img(dataurl, row) {
      clearTimeout(this.timer)
      var formData = new FormData()
      formData.append('parameterType', '磁致伸缩样品基本参数')
      formData.append('type', '磁致伸缩伸缩' + this.conditionInfo.timeTypes + this.conditionInfo.curveTypes)
      formData.append('id', this.ciZhiTableRow.id)
      formData.append('dataId', row.id)
      formData.append('file', this.dataURLtoFile(dataurl, 'tupian.png'))
      formData.append('userId', JSON.parse(window.localStorage.getItem('pro__Login_Userinfo')).value.id)
      formData.append('filename', row.fileName)
      formData.append('grade', this.ciZhiTableRow.grade)
      formData.append('parameterId', this.ciZhiTableRow.parameterId)
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: `/user/report`,
        method: 'POST',
        data: formData,
        responseType: 'blob', // 表明返回服务器返回的数据类型
      }).then((res) => {
        this.loading.close()
        let blob = new Blob([res.data], {
          type: 'application/msword',
        })
        let fileName = '测试报告.docx'
        if (window.navigator.msSaveOrOpenBlob) {
          navigator.msSaveBlob(blob, fileName)
        } else {
          var link = document.createElement('a')
          link.href = window.URL.createObjectURL(blob)
          link.download = fileName
          link.click()
          //释放内存
          window.URL.revokeObjectURL(link.href)
        }
      })
    },
    /*---------------------echarts转图片传后端并接受后端文件流下载文件--------------------- */

    /*************** 选择排序规则相关函数  *********************/
    selectSort(e) {
      this.sort = e
      if (e == '') {
        this.sort = '/null'
      }
      this.loadData()
    },
    /*************** 选择排序规则相关函数  *********************/

    /*************** 导入相关函数  *********************/
    single() {
      //单个导入
      //通过ref获取el-table的表头数据
      this.columnTitle = this.$refs.ciZhiTable.$children
        .filter((x) => {
          return x._props.prop !== undefined
        })
        .map((x) => {
          return new Object({
            prop: x._props.prop,
            label: x._props.label,
          })
        })
      this.$refs.singleImport.getEditRowAndColumn(this.columnTitle)
    },
    handleChange(info) {
      if (info.file.status == 'done') {
        if (info.file.response.code == 0) {
          this.batchVisible = false
          this.importTag = false
          Message({
            message: '批量导入成功！',
            type: 'success',
            center: true,
            customClass: 'mzindex'
          })
        } else {
          this.batchVisible = false
          this.importTag = false
          Message({
            message: '批量导入失败！',
            type: 'error',
            center: true,
            customClass: 'mzindex'
          })
        }
      }
    },
    attHandleChange(info) {
      if (info.file.status == 'done') {
        if (info.file.response.code == 200) {
          this.importTag = false
          Message({
            message: '附件导入成功！',
            type: 'success',
            center: true,
            customClass: 'mzindex'
          })
        } else {
          this.importTag = false
          Message({
            message: '附件导入失败！',
            type: 'error',
            center: true,
            customClass: 'mzindex'
          })
        }
      }
    },
    /*************** 导入相关函数  *********************/

    /*************** 关注  *********************/
    getFocusOn(row) {
      this.focusOnLabel.grade = row.grade
      this.focusOnLabel.specification = row.specification
      this.focusOnLabel.country = row.country
      this.focusOnLabel.manufacturer = row.manufacturer
      this.focusOnLabel.standard = row.standard
      this.focusOnValue.grade = 'grade-' + row.grade
      this.focusOnValue.specification = 'specification-' + row.specification
      this.focusOnValue.country = 'country-' + row.country
      this.focusOnValue.manufacturer = 'manufacturer-' + row.manufacturer
      this.focusOnValue.standard = 'standard-' + row.standard
      this.focusOnVisible = true
    },
    confirmFocusOn() {
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/attentionTable/attention',
        method: 'POST',
        data: this.focusOnImportData,
      }).then((res) => {
        if (res.data.result.code == 300) {
          Message({
            message: res.data.result.message,
            type: 'warning',
            center: true,
            customClass: 'mzindex',
          })
        } else if (res.data.result.code == 200) {
          Message({
            message: res.data.result.message,
            type: 'success',
            center: true,
            customClass: 'mzindex',
          })
        }
      })
      this.focusOnVisible = false
    },
    closeFocusOn() {
      this.focusOnVisible = false
    },
    getRadioValue(e) {
      const strArr = e.target.value.split('-')
      this.focusOnImportData.property = strArr[0]
      this.focusOnImportData.content = strArr[1]
    },
    /*************** 关注  *********************/

    /*************** 点赞或踩  *********************/
    forOrAgainst(row, state) {
      console.log('点赞踩row', row)
      var support = row.support
      var against = row.against
      if (state == 'like') {
        if (support == 1) {
          //已点赞，再次点击，就是取消这个点赞
          support = 0
          against = 0
        } else {
          //未点赞
          support = 1
          against = 0
        }
      } else if (state == 'dislike') {
        if (against == 1) {
          //已踩，再次点击，就是取消这个踩
          against = 0
          support = 0
        } else {
          //未踩
          against = 1
          support = 0
        }
      }
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/forAndAgainstTable/forOrAgainst',
        method: 'POST',
        data: {
          userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id,
          parameterId: row.id,
          support: support,
          against: against,
          type: '磁致伸缩样品基本参数',
        },
      }).then((res) => {
        this.loadData()
      })
    },
    /*************** 点赞或踩  *********************/

    /*************** 收藏相关函数  *********************/
    collect(row) {
      this.collectVisible = true
      this.collectinformation = row
    },
    confirmCollect() {
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/collectTable/collect',
        method: 'POST',
        data: {
          userId: JSON.parse(window.localStorage.getItem('pro__Login_Userinfo')).value.id,
          username: JSON.parse(window.localStorage.getItem('pro__Login_Userinfo')).value.username,
          measurementType: '磁致伸缩' + this.conditionInfo.timeTypes + this.conditionInfo.curveTypes,
          measurementId: this.collectinformation.id,
          specification: this.ciZhiTableRow.specification,
          parameterNum: this.ciZhiTableRow.parameterId,
          parameterId: this.ciZhiTableRow.id,
          grade: this.ciZhiTableRow.grade,
          parameterType: '磁致伸缩样品基本参数',
          name: this.collectinSupplement,
        },
      }).then((res) => {
        if (res.data.code == 200) {
          this.collectVisible = false
          this.collectinSupplement = ''
          Message({
            message: res.data.message,
            type: 'success',
            center: true,
            customClass: 'mzindex',
          })
        } else if (res.data.code == 500) {
          this.collectVisible = false
          this.collectinSupplement = ''
          Message({
            message: res.data.message,
            type: 'error',
            center: true,
            customClass: 'mzindex',
          })
        }
      })
    },
    closeCollect() {
      this.collectVisible = false
      this.collectinSupplement = ''
    },
    /*************** 收藏相关函数  *********************/

    /*************** 快速查询相关函数  *********************/
    resetQueryKs() {
      this.queryInfo.pageNum = 1
      this.queryInfo.pageSize = 10
      this.queryNum = 1
      this.loadData()
    },

    getTableFastResult(content) {
      this.queryNum = 3
      this.fastSearchData.content = content
      this.queryInfo.pageNum = 1
      this.queryInfo.pageSize = 10
      this.$refs.fastSearch.getMySearchHistory()
      this.loadData()
    },
    /*************** 快速查询相关函数  *********************/

    /*************** 高级查询相关函数  *********************/
    resetQuery() {
      this.queryInfo.pageNum = 1
      this.queryInfo.pageSize = 10
      this.queryNum = 1
      this.loadData()
    },
    //获取高级查询组件查询结果
    getTableInquiryResult(queryArray, andOr) {
      this.queryNum = 2
      this.advancedSearchData.queryArray = queryArray
      this.advancedSearchData.andOr = andOr
      this.queryInfo.pageNum = 1
      this.queryInfo.pageSize = 10
      this.loadData()
    },
    //获取主表的ref信息
    getTableRef() {
      this.$refs.advancedSearch.getTableColumn(this.$refs.ciZhiTable) //括号内的ref名字记得根据不同表进行修改
    },
    /*************** 高级查询相关函数  *********************/

    // 获取elements表头
    getTableColumn() {
      //通过ref获取el-table的表头数据
      let columnTitle = this.$refs.ciZhiTable.$children
        .filter((x) => {
          return x._props.prop !== undefined
        })
        .map((x) => {
          return new Object({
            value: x._props.prop,
            label: x._props.label,
          })
        })
      this.headeroptions = columnTitle
      this.headerCondition.push(columnTitle)
      console.log("headeroptions----------",this.headeroptions);
    },
    importOneParamter() {},

    //测量数据导出按钮
    exportMeasureData() {
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/ExportData/exportData',
        method: 'POST',
        data: new Object({ id: this.exportMeasureDataId, type: '磁致伸缩样品基本参数', dataType: this.conditionInfo.timeTypes + this.conditionInfo.curveTypes, specification: this.ciZhiTableRow.specification }),
        responseType: 'blob',
      }).then((res) => {
        const blob = new Blob([res.data])
        const url = window.URL.createObjectURL(blob)
        const link = document.createElement('a')
        link.style.display = 'none'
        link.download = '测量数据.txt'
        link.href = url
        link.click()
      })
    },
    //模板导出按钮
    exportData() {
      if (this.fileFlag === -1) return
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: `/admin/downLoadLessonFile?name=${this.downFileName[this.fileFlag]}`,
        methods: 'GET',
        responseType: 'blob',
      }).then((res) => {
        const blob = new Blob([res.data])
        const url = window.URL.createObjectURL(blob)
        const link = document.createElement('a')
        link.style.display = 'none'
        link.download = `${this.downFileName[this.fileFlag]}.xlsx`
        link.href = url
        link.click()
      })
    },
    //导入
    showImport(tag, index) {
      Message({
        message: '程序员正在加班中！',
        center: true,
        customClass: 'myMessageClass'
      })
      return
      this.importTag = true
      this.importflag = tag
      this.fileFlag = index
    },

    showDataImport() {
      if (this.importflag == '磁致伸缩批量导入模板') {
        this.single()
      } 
    },

    //控制折叠
    foldComment(index) {
      if (this.isfold[index] == false) {
        this.isfold[index] = true
        this.$forceUpdate() //强制渲染
      } else {
        this.isfold[index] = false
        this.$forceUpdate() //强制渲染
      }
    },
    //评论部分点击发送按钮
    //评论部分点击发送按钮
    addComment(it) {
      var comment1 = {}
      comment1.userId = JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
      comment1.dataId = it.dataId
      comment1.parentCommentId = it.id
      comment1.nickname = eval('(' + window.localStorage.getItem('pro__Login_Userinfo') + ')').value.realname
      comment1.content = this.reply
      comment1.createTime = ''
      comment1.type = '磁致伸缩样品基本参数'
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/systemmanagement/comment/commentDataSave',
        method: 'POST',
        data: comment1,
      }).then((res) => {
        if ((res.data.flag = true)) {
          this.$message.success('评论成功！！！')
          this.getComment(this.commentId)
        }
      })
      this.flag = -1
      this.reply = ''
    },
    addNewComment(id) {
      var comment1 = {}
      comment1.userId = JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
      comment1.dataId = id
      comment1.parentCommentId = ''
      comment1.nickname = eval('(' + window.localStorage.getItem('pro__Login_Userinfo') + ')').value.realname
      comment1.content = this.newComment
      comment1.createTime = ''
      comment1.type = '磁致伸缩样品基本参数'
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/systemmanagement/comment/commentDataSave',
        method: 'POST',
        data: comment1,
      }).then((res) => {
        if ((res.data.flag = true)) {
          this.$message.success('评论成功！！！')
          this.getComment(this.commentId)
          this.newComment = ''
        }
      })
      this.flag = -1
      this.reply = ''
    },
    //评论部分点击取消按钮
    cancelComment() {
      this.flag = -1
      this.reply = ''
    },
    //点击回复，禁用所有回复
    replyComment(index) {
      this.flag = index
    },
    //子评论的回复
    replyComment1(id) {
      this.flag = id
    },
    //当输入框失去焦点时
    showComment() {
      if (this.commentDetail === '') {
        this.flag = -1
      }
    },
    //获取所有评论
    getComment(rowId) {
      this.commentId = rowId
      this.commentDialog = true
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        method: 'GET',
        url: `/systemmanagement/comment/commentDataList?dataId=${this.commentId}`,
      }).then((res) => {
        this.comment = res.data.data
        this.comment = this.comment.map((x) => {
          x.commentNum = x.replyComments.length
          return x
        })
      })
      for (var i = 0; i < this.comment.length; i++) {
        this.isfold[i] = false
      }
    },
    //获取测量条件
    getCondition() {
      var dataMessage = {}
      var condition = {}
      condition.curveTypes = this.conditionInfo.timeTypes + this.conditionInfo.curveTypes
      condition.productId = this.conditionInfo.productId
      dataMessage.conditionVo = condition
      dataMessage.pageVo = this.pageVo
      console.log("dataMessage",dataMessage)
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/cizhi/magnetostriction-parameter/selectTestCondition',
        method: 'post',
        data: dataMessage,
      }).then((res) => {
        console.log("res",res)
        this.conditionList = []
        this.conditionList = res.data.result.data
        this.oldTableData = JSON.parse(JSON.stringify(this.conditionList))
        this.tempDatalist = JSON.parse(JSON.stringify(this.conditionList)) //用于后面如果要恢复隐藏的数据使用
      })
    },
    //获取测量数据，渲染echarts
    addChart(rows) {
      this.hideSelection = []
      this.hideSelection = rows

      this.currentCheckedNum = rows.length
      var h = -1
      this.GraphOption.series = []
      if (rows == []) return false
      var arr = rows.map((x) => {
        this.exportMeasureDataId = x.id
        return x.id
      })

      //通过ref获取el-table的表头数据
      let columnTitle = this.$refs.measureTable.$children[0].$children
        .filter((x) => {
          return x._props.prop !== undefined
        })
        .map((x) => {
          return new Object({
            prop: x._props.prop,
            label: x._props.label,
          })
        })
      var nameTitle = rows.map((x) => {
        let addTitle = ''
        for (let i = 0; i < columnTitle.length; i++) {
          addTitle = addTitle + columnTitle[i].label + ':' + x[`${columnTitle[i].prop}`] + ','
        }
        return addTitle
      })

      if (arr == '') {
        this.myChart.clear()
      } else {
        this.myChart = echarts.init(document.getElementById('main'))
        this.myChart.showLoading()
        console.log(this.chartSpecification,"{this.chartSpecification");
        this.axios({
          baseURL: 'http://59.172.104.174:30669',
          url: `/cizhi/magnetostriction-parameter/selectTestData/${this.chartSpecification}`,
          method: 'POST',
          data: new Object({ type: this.conditionInfo.timeTypes + this.conditionInfo.curveTypes, dataId: arr }),
        }).then((res) => {
          this.measureHead = []
          // 处理表头数据
          for (let i = 0; i < res.data.result.comments.length; i++) {
            let addData = {
              label: '',
              name: '',
            }
            addData.label = res.data.result.comments[i].label
            addData.name = res.data.result.comments[i].name
            this.measureHead.push(addData)
          }
          console.log("this.measureHead",this.measureHead)
          // 处理表身数据
          this.measureList = []
          this.measureList = res.data.result.list[res.data.result.list.length - 1]
          console.log("this.measureList",this.measureList)

          //type=1为普通echarts图表，type=2为以频率为横坐标的图表，type=3为以数据个数为横坐标的图表
          if (res.data.result.type == 3) {
            // 处理echarts表x、y1、y2轴名称
            this.GraphOption.xAxis.name = 'Sample Number' //x轴
            this.GraphOption.yAxis[1].show = true
            this.GraphOption.yAxis[0].name = res.data.result.comments[0].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[1].label + '  -■-' //y2轴
            this.xAxisName = 'Sample Number'
            this.yAxisName = res.data.result.comments[0].label
            this.yAxisAnotherName = res.data.result.comments[1].label
            if (this.GraphOption.xAxis.min != undefined) {
              this.$delete(this.GraphOption.xAxis, 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 'dataMax')
            this.$set(this.GraphOption.yAxis[0], 'max', 1)
            this.$set(this.GraphOption.yAxis[0], 'min', -1)
            this.$set(this.GraphOption.yAxis[1], 'max', 1)
            this.$set(this.GraphOption.yAxis[1], 'min', -1)

            console.log(this.GraphOption.xAxis)
            console.log(this.GraphOption.yAxis)
            console.log(this.xAxisName)
            console.log(this.yAxisName)

            // 缩放为1处理
            let zoomYOne = res.data.result.maxY
            let zoomYTwo = res.data.result.maxX

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              for (let j = 0; j < res.data.result.list[i].length; j++) {
                var grandsonArrayOne = []
                var grandsonArrayTwo = []
                for (let k in res.data.result.list[i][j]) {
                  if (k == res.data.result.comments[1].name) {
                    grandsonArrayOne[0] = j
                    grandsonArrayOne[1] = res.data.result.list[i][j][k] / zoomYOne
                  } else if (k == res.data.result.comments[0].name) {
                    grandsonArrayTwo[0] = j
                    grandsonArrayTwo[1] = res.data.result.list[i][j][k] / zoomYTwo
                  }
                }
                sonArrayOne[j] = grandsonArrayOne
                sonArrayTwo[j] = grandsonArrayTwo
              }
              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false,
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect',
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }

            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 2) {
            // 处理echarts表x、y1、y2轴名称
            this.GraphOption.xAxis.name = 'time/s' //x轴
            this.GraphOption.yAxis[1].show = true
            this.GraphOption.yAxis[0].name = res.data.result.comments[0].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[1].label + '  -■-' //y2轴
            this.xAxisName = 'time/s'
            this.yAxisName = res.data.result.comments[0].label
            this.yAxisAnotherName = res.data.result.comments[1].label
            if (this.GraphOption.xAxis.min != undefined) {
              this.$delete(this.GraphOption.xAxis, 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 'dataMax')
            this.$set(this.GraphOption.yAxis[0], 'max', 1)
            this.$set(this.GraphOption.yAxis[0], 'min', -1)
            this.$set(this.GraphOption.yAxis[1], 'max', 1)
            this.$set(this.GraphOption.yAxis[1], 'min', -1)

            // 缩放为1处理
            let timeOptions = []
            for (let i = 0; i < rows.length; i++) {
              timeOptions[i] = 1 / rows[i].frequency
            }
            let zoomYOne = res.data.result.maxY
            let zoomYTwo = res.data.result.maxX

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              let jSub = timeOptions[i] / res.data.result.list[i].length
              for (let j = 0, m = 0; j < timeOptions[i]; m++) {
                var grandsonArrayOne = []
                var grandsonArrayTwo = []
                for (let k in res.data.result.list[i][m]) {
                  if (k == res.data.result.comments[1].name) {
                    if (m == res.data.result.list[i].length - 1) {
                      // 定死x轴坐标最大值
                      grandsonArrayOne[0] = timeOptions[i]
                    } else {
                      grandsonArrayOne[0] = j
                    }
                    grandsonArrayOne[1] = res.data.result.list[i][m][k] / zoomYOne
                  } else if (k == res.data.result.comments[0].name) {
                    if (m == res.data.result.list[i].length - 1) {
                      // 定死x轴坐标最大值
                      grandsonArrayTwo[0] = timeOptions[i]
                    } else {
                      grandsonArrayTwo[0] = j
                    }
                    grandsonArrayTwo[1] = res.data.result.list[i][m][k] / zoomYTwo
                  }
                }
                sonArrayOne[m] = grandsonArrayOne
                sonArrayTwo[m] = grandsonArrayTwo

                j = j + jSub
              }
              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false,
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect',
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }
            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 1) {
            // 处理echarts表x、y轴名称
            this.GraphOption.xAxis.name = res.data.result.comments[0].label //x轴
            this.GraphOption.yAxis[1].show = false
            this.GraphOption.yAxis[0].name = res.data.result.comments[1].label //y轴
            this.xAxisName = res.data.result.comments[0].label
            this.yAxisName = res.data.result.comments[1].label
            this.yAxisAnotherName = res.data.result.comments[1].label
            if (this.GraphOption.yAxis[0].max != undefined) {
              this.$delete(this.GraphOption.xAxis, 'max')
              this.$delete(this.GraphOption.yAxis[0], 'max')
              this.$delete(this.GraphOption.yAxis[0], 'min')
              this.$delete(this.GraphOption.yAxis[1], 'max')
              this.$delete(this.GraphOption.yAxis[1], 'min')
            }
            console.log(this.GraphOption.xAxis)
            console.log(this.GraphOption.yAxis)
            console.log(this.xAxisName)
            console.log(this.yAxisName)

            // // 设置x,y轴最大最小值（以最小值0.9倍，最大值1.1倍就行设计）
            // this.$set(this.GraphOption.xAxis, 'max', function (value) {
            //   var num = 0
            //   if (value.max.toString().split('.')[1] != undefined) {
            //     num = value.max.toString().split('.')[1].length
            //   }
            //   if (value.max >= 0) {
            //     return (value.max * 1.1).toFixed(num)
            //   } else {
            //     return (value.max * 0.9).toFixed(num)
            //   }
            // })
            // this.$set(this.GraphOption.xAxis, 'min', function (value) {
            //   var num = 0
            //   if (value.min.toString().split('.')[1] != undefined) {
            //     num = value.min.toString().split('.')[1].length
            //   }
            //   if (value.min < 0) {
            //     return (value.min * 1.1).toFixed(num)
            //   } else {
            //     return (value.min * 0.9).toFixed(num)
            //   }
            // })
            // this.$set(this.GraphOption.yAxis[0], 'max', function (value) {
            //   var num = 0
            //   if (value.max.toString().split('.')[1] != undefined) {
            //     num = value.max.toString().split('.')[1].length
            //   }
            //   if (value.max >= 0) {
            //     return (value.max * 1.1).toFixed(num)
            //   } else {
            //     return (value.max * 0.9).toFixed(num)
            //   }
            // })
            // this.$set(this.GraphOption.yAxis[0], 'min', function (value) {
            //   var num = 0
            //   if (value.min.toString().split('.')[1] != undefined) {
            //     num = value.min.toString().split('.')[1].length
            //   }
            //   if (value.min < 0) {
            //     return (value.min * 1.1).toFixed(num)
            //   } else {
            //     return (value.min * 0.9).toFixed(num)
            //   }
            // })


            console.log(res.data.result.comments[0].name)
            console.log(res.data.result.comments[1].name)

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArray = []
              for (let j = 0; j < res.data.result.list[i].length; j++) {
                var grandsonArray = []
                for (let k in res.data.result.list[i][j]) {
                  if (k == res.data.result.comments[0].name) {
                    grandsonArray[0] = res.data.result.list[i][j][k]
                  } else if (k == res.data.result.comments[1].name) {
                    grandsonArray[1] = res.data.result.list[i][j][k]
                  }
                }
                sonArray[j] = grandsonArray
              }
              let inputParams = {
                name: nameTitle[i],
                data: sonArray,
                type: 'line',
                smooth: false,
              }
              this.GraphOption.series.push(inputParams)
            }

            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
            console.log('this.GraphOption', this.GraphOption)
          }

          this.dynamicSetGridAndHeight(rows)
        })
      }
    },
    // 随机生成一个rgb颜色
    randColor() {
      let colorw = `rgb(${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)})`
      return colorw
    },
    dynamicSetGridAndHeight(rows) {
      let legendNum = rows.length
      if (legendNum == 0) {
        this.GraphOption.grid[0].top = 40
        this.graphHeight = 600
      } else {
        this.GraphOption.grid[0].top = 30 + 20 * legendNum + Math.trunc(legendNum / 10) * 20
        this.graphHeight = 600 + 20 * (legendNum - 1)
      }
      this.$nextTick(() => {
        this.drawChart(this.graphHeight)
      })
    },
    // 切换缩放模式
    changeDataZoom(dataZoomType) {
      if(dataZoomType == 'slider') {
        this.dataZoomType = 'inside'
        this.GraphOption.dataZoom[0].type = 'inside'
        this.GraphOption.dataZoom[1].type = 'inside'
        this.fittingOption.dataZoom[0].type = 'inside'
        this.fittingOption.dataZoom[1].type = 'inside'
      } else {
        this.dataZoomType = 'slider'
        this.GraphOption.dataZoom[0].type = 'slider'
        this.GraphOption.dataZoom[1].type = 'slider'
        this.fittingOption.dataZoom[0].type = 'slider'
        this.fittingOption.dataZoom[1].type = 'slider'
      }
      this.myChart.setOption(this.GraphOption)
    },
    drawChart(relHeight) {
      this.myChart.clear()
      this.myChart.hideLoading()
      this.myChart.setOption(this.GraphOption)
      const autoHeight = relHeight
      // myChart.getDom().style.height = autoHeight + 'px'
      this.myChart.resize()
    },
    showGraph() {
      if (this.conditionInfo.curveTypes !== '' && this.conditionInfo.timeTypes !== '' && this.conditionInfo.productId !== '') {
        this.getCondition()
      }
    },


    //曲线类型选择判断
    judge(curve, display, type) {
      this.$refs.measureTable.clearSelection()
      this.curve = curve
      this.display = display
      this.conditionInfo.curveTypes = curve
      this.conditionInfo.timeTypes = display
      this.curveType = type
      if (curve === '原始波形') {
        this.Xname = this.yx
        this.Yname = this.yy
      } else if (curve === '蝴蝶曲线') {
        this.Xname = this.dx
        this.Yname = this.dy
      } else if (curve === '磁滞回线') {
        this.Xname = this.hx
        this.Yname = this.hy
      }
      this.showGraph()
    },
    
    //勾选一项的事件
    parameterSelect(selection, row) {
      if(selection.length < 1) {
        this.$refs.measureDetailed.unSelected(true)
      } else {
        this.$refs.measureDetailed.unSelected(false)
      }
      if (selection.length > 1) {
        this.$refs.ciZhiTable.clearSelection()
        selection.shift()
        this.$refs.ciZhiTable.toggleRowSelection(row)
      }
      // // 高亮当前行
      // this.$refs.ciZhiTable.setCurrentRow(row)

      this.ciZhiTableRow = row
      this.axios({
        //获取数量
        baseURL: 'http://59.172.104.174:30669',
        url: `/cizhi/magnetostriction-parameter/selectNum?id=${row.id}`,
        methods: 'GET',
      }).then((res) => {
        this.conditionNum = res.data.result
      })
      this.producerDetail = {
        producer: '',
        country: '',
        address: '',
        email: '',
        website: '',
        telephone: '',
        fax: '',
        staff: '',
        remarks: '',
      }
      this.sampleSize = row.specification
      this.conditionInfo.productId = row.id
      this.mark = row.grade
      this.country = row.country
      this.producer = row.manufacturer
      this.selectNum = row.parameterId
      this.chartSpecification = row.specification
      this.showGraph()
      this.$refs.measureDetailed.getDetailMessage(row.dataType, row.specification, this.mark, this.country, this.producer, this.conditionInfo, this.selectNum)
    },
    handleSizeChange(newSize) {
      this.queryInfo.pageSize = newSize
      this.loadData()
    },
    handleCurrentChange(newPage) {
      this.queryInfo.pageNum = newPage
      this.loadData()
    },
    //页码改变
    handleSizeChange1(newSize) {
      this.pageVo.pageSize = newSize
      this.getCondition()
    },
    handleCurrentChange1(newPage) {
      this.pageVo.pageNum = newPage
      this.getCondition()
    },
    // 获取测量条件
    loadData() {
      var obj = {
        superPageVo: {
          pageNum: this.queryInfo.pageNum,
          pageSize: this.queryInfo.pageSize,
          userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
        },
        advancedVo: {
          pageNum: this.queryInfo.pageNum,
          pageSize: this.queryInfo.pageSize,
          queryArray: this.advancedSearchData.queryArray,
          type: '',
          andOr: this.advancedSearchData.andOr,
          userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
        },
        searchPageVo: {
          pageNum: this.queryInfo.pageNum,
          pageSize: this.queryInfo.pageSize,
          content: this.fastSearchData.content,
          userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
        },
        num: this.queryNum,
        content: this.primaryTableSort.content,
        sortOrder: this.primaryTableSort.sortOrder
      }
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: `/cizhi/magnetostriction-parameter/selectParameter${this.sort}`,
        method: 'POST',
        data: obj,
      }).then((res) => {
        this.parameterList = res.data.result.records
        this.total = res.data.result.total
      })
    },
    operationShow() {
      console.log("isOperationShow---",this.isOperationShow)
      this.isOperationShow = !this.isOperationShow
      var operationDiv = document.getElementsByClassName('el-table__fixed-right')[0]
      if(this.isOperationShow == true) {
        operationDiv.style.display = 'block'
      } else {
        operationDiv.style.display = 'none'
      }
      console.log(operationDiv.style)
      console.log("isOperationShow---",this.isOperationShow)
    },
    // 自定义列
    tableColumnShow(item) {
      this.$set(item, 'isShow', !item.isShow)
      // console.log("columnShowNameList---",this.columnShowNameList)
    },
    // 自定义列————默认勾选
    defaultTableColumnShow() {
      console.log('----------defaultTableColumnShow---------');
      for(var i = 0; i < this.columnShowList.length; i++){
        if(this.columnShowList[i].label == '样品柜编号' || this.columnShowList[i].label == '项目组' || this.columnShowList[i].label == '样品提供人' || this.columnShowList[i].label == '备注' ||
          this.columnShowList[i].label == '电导率/(S/m)' || this.columnShowList[i].label == '热导率/(W/m-k)' || this.columnShowList[i].label == '屈服强度/MPa' || this.columnShowList[i].label == '居里温度/Cel.Deg.' ){
          this.columnShowList[i].isShow = false
        } else {
          this.columnShowList[i].isShow = true
        }
      }
      this.columnShowNameList = [ '编号', '牌号', '国别', '生产商', '执行标准', '标称密度/(kg/m³)', '样品规格', '孔隙率', '单片厚度', '标称叠压系数', '饱和磁密/T', '饱和磁致伸缩系数/ppm', '入库日期', '数据来源' ]
      // console.log("columnShowNameList---",this.columnShowNameList)
    },
    // 自定义列————全部勾选
    allTableColumnShow() {
      console.log('----------allTableColumnShow---------');
      for(var i = 0; i < this.columnShowList.length; i++){
        this.columnShowList[i].isShow = true
      }
      this.columnShowNameList = [ '编号', '牌号', '国别', '生产商', '执行标准', '标称密度/(kg/m³)', '样品规格', '孔隙率', '单片厚度', '标称叠压系数', '饱和磁密/T', '饱和磁致伸缩系数/ppm', '电导率/(S/m)', '热导率/(W/m-k)', '屈服强度/MPa', '居里温度/Cel.Deg.', '入库日期', '样品柜编号', '项目组', '样品提供人', '数据来源', '备注' ]
      // console.log("columnShowNameList---",this.columnShowNameList)
    },
    renderHeader(h, { column, $index }) {
      // console.log(h, column, $index);
      const label = column.label;
      return [
        h(
          "el-tooltip",
          {
            props: {
              content: (function() {
                return label;
              })(),
              placement: "top",
            },
          },
          [h("span", {}, label)]
        ),
      ];
    },
  },
}
</script>
<style lang="less" scoped>
/deep/.el-table__body-wrapper.is-scrolling-left {
  height: 429px !important;
}
</style>
<style scoped>
.box {
  margin-top: 10px;
  display: flex;
  /* justify-content: space-between; */
}
.el-divider--horizontal {
  font-weight: 100;
  display: block;
  height: 1px;
  width: 100%;
  margin: 10px 0;
}
/*去除顶部标头的选择框*/
.el-table >>> .DisabledSelection .cell .el-checkbox__inner {
  display: none;
  position: relative;
}

/*修改el-table中排序小三角样式*/
::v-deep .el-table .caret-wrapper {
  height: 45px;
}
::v-deep .el-table .sort-caret {
  border: 7px solid transparent;
}
::v-deep .el-table .sort-caret.ascending {
  border-bottom-color: #c0c4cc;
  top: 5px;
}
::v-deep .el-table .sort-caret.descending {
  border-top-color: #c0c4cc;
  bottom: 7px;
}
::v-deep .descending .sort-caret.descending {
  border-top-color: #4e9efd;
}
::v-deep .ascending .sort-caret.ascending {
  border-bottom-color: #4e9efd;
}
</style>

<style lang="less" scoped>
/deep/.mainTable.el-table th > .cell {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  white-space: nowrap;
  -webkit-box-orient: vertical;
  word-break: break-all;
  height: 50px;
  line-height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}
/deep/.mainTable.el-table--border th.el-table__cell, .mainTable.el-table__fixed-right-patch {
  background: rgb(250, 250, 250);
}
.mainTable{
  /deep/.caret-wrapper {
    display: none;
  }
  /deep/.sortableShow .caret-wrapper {
    display: block;
  }
}
/deep/.mainTable.el-table__fixed-right {
  border-left: 1px solid #ebeef5;
}
.tableColumnDiv{
  /deep/label.el-checkbox {
    display: flex;
    align-items: center;
  }
  /deep/.el-checkbox__label {
    flex: 1;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: rgba(0,0,0,.65) !important;
  }
  /deep/.el-checkbox__input.is-checked+.el-checkbox__label {
    flex: 1;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: rgba(0,0,0,.65) !important;
  }
  /deep/label.el-checkbox:nth-child(2n) {
    margin-right: 0;
  }
  /deep/label.el-checkbox:nth-child(2n-1) {
    margin-right: 20px;
  }
}
</style>


